package think.in.java.concurrency.practise.exec8.ForBlockQueue;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by IntelliJ IDEA.
 * User: Richard
 * Date: 6/18/11
 * Time: 12:19 AM
 * To change this template use File | Settings | File Templates.
 */
public class MainRunner {

    public static void  main(String[] args){
        ExecutorService executor = Executors.newSingleThreadExecutor();
        List<Chef> chefList = new ArrayList<Chef>();
        List<Waiter> waiterList = new ArrayList<Waiter>();
        Restrant restrant = new Restrant();
        for(int i =0; i<3 ; i++){
            chefList.add(new Chef(restrant,i));
            waiterList.add(new Waiter(restrant,i));
        }
        restrant.setChefs(chefList);
        restrant.setWaiters(waiterList);
        executor.execute(restrant);
    }
}
